const express = require('express');
const favoriteNameRouter = require('./../routes/favoriteNameRoutes');
const userController = require('./../controllers/userController');
const authController = require('./../controllers/authController');
const favoriteNameController = require('./../controllers/favoriteNameController');
const videoRouter = require('./../routes/videoRoutes');

const columnRouter = require('./../routes/columnRoutes');
const router = express.Router();

router.use('/:userId/favorites', favoriteNameRouter);
router.use('/:userId/videos', videoRouter);
router.use('/:userId/columns', columnRouter);
// router.use('/:userId/videoReviews', videoReviewRouter);
router.post('/login', authController.login);
router.post(
  '/signup',
  authController.signup
  // favoriteNameController.createDefaultFavorite
);
// router.get('/me', userController.getMe, userController.getUser);

router.delete('/deleteMe', authController.protect, userController.deleteMe);
router.patch('/updateMe', authController.protect, userController.updateMe);
router.patch(
  '/updatePassword',
  authController.protect,
  authController.updatePassword
);
router.patch('/forgetPassword', authController.forgetPassword);
router.post('/resetPassword/:token', authController.resetPassword);
router
  .route('/')
  .get(userController.getAllUsers)
  .post(userController.createUser);
router
  .route('/:id')
  .get(userController.getUser)
  .patch(userController.updateUser)
  .delete(userController.deleteUser);

// router.route('/');
module.exports = router;
